package com.Controller;

import com.Service.UserService;
import com.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class LoginServlet {
    /*ApplicationContext ac  = new ClassPathXmlApplicationContext("applicationContext.xml.bak");
    *//* ApplicationContext ac  = new AnnotationConfigApplicationContext(SpringConfig.class);*//*
    UserService cs= (UserService)ac.getBean(UserService.class);*/
    @Autowired
    private UserService userService;
    @RequestMapping("/LoginServlet")
    @ResponseBody
    public String login(User user){
        User u = userService.findId(user);
        if (u != null){
            return "true";

        }else {
            return "false";
        }
    }
}
